a = 077
b = a&3
print '077&3=%d'%b
b&=7
print '077&3&7=%d'%b

a = 077
b = a | 3
print '077|3=%d' % b
b |= 7
print '077|3|7=%d' % b

a = 077
b = a ^ 3
print '077^3=%d' % b
b ^= 7
print '077^3^7=%d' % b